package com.lizhi.yun.core.handler;/**
 * @program: sfrobot-html
 * @name StandPtInfoHnadler
 * @description: 患者信息
 * @author: lizhi
 * @create: 2020-04-24 16:10
 */

import com.lizhi.common.yun.entity.ListResponseResult;
import com.lizhi.utils.json.SamJsonUtil;
import com.lizhi.yun.db.stand.dao.StandPtInfoDao;
import com.lizhi.yun.db.stand.pojo.StandPtInfoPOJO;
import com.lizhi.mybatis.interceptor.PageBounds;
import com.lizhi.yun.deploy.NewBaseHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 *@program: sfrobot-html
 *@name StandPtInfoHnadler
 *@description: 患者信息
 *@author: lizhi
 *@create: 2020-04-24 16:10
 */
@Slf4j
@Service
public class ServicePtInfoHnadler extends NewBaseHandler {

    @Resource
    private StandPtInfoDao standPtInfoDao;

    /**
     *功能描述 分页查询
     * @author lizhi
     * @date 2020/4/24
     * @param json:
     * @return com.lizhi.common.base.PagerView<com.lizhi.db.pojo.StandPtInfoPOJO>
     */
    public ListResponseResult doMain(String json) {
        log.info("获取到的json:{}", json);
        Map<String, Object> map = SamJsonUtil.toMap(json);
        PageBounds pageBounds = getPageBounds(map);
        List<StandPtInfoPOJO> listStandPtInfos = standPtInfoDao.selectByMap(map, pageBounds);
        return getListResult(pageBounds.getCountRows(), listStandPtInfos, map);
    }


    /**
     *功能描述 根据String ptId查询患者信息
     * @author lizhi
     * @date 2020/4/24
     * @param ptId:
     * @return com.lizhi.db.pojo.StandPtInfoPOJO
     */
    public ListResponseResult selectById(String ptId, String hospitalId, String hospitalSystemId){
        StandPtInfoPOJO standPtInfoPOJO = standPtInfoDao.selectById(ptId, hospitalId, hospitalSystemId);
        return getListResult(standPtInfoPOJO);
    }
}
